/**
 * 
 */
package appControll;

import java.util.ArrayList;

import exceptions.*;

import business.*;

import model.*;

/**
 * @author Anthares & Hennek
 *
 */
public class AppController {
	private SectionManager sectMan = new SectionManager();
	private LoginManager loginMan = new LoginManager();
	private EtudiantManager etuMan = new EtudiantManager();
	private SyllabusManager sylMan = new SyllabusManager();
	private CommandeEtuManager comEtuMan =  new CommandeEtuManager();
	private LotManager lotMan =  new LotManager();
	private RechercheManager rechMan = new RechercheManager();
	
	public ArrayList<Section> getAllSection() throws PasIdentificationException, DatabaseErrorException {
		return sectMan.getAllSection();
	}
	public MembreComite identification(String userLogin, String userPass, String dbPass) throws ErreurIdentification, PasIdentificationException, BadLoginException, ODBCErrorException, BadPasswordException, DatabaseErrorException, InvalidDataException{
		return loginMan.identification(userLogin, userPass, dbPass);
	}
	public ArrayList<Etudiant> getEtudiant(int annee, int section_id) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		return etuMan.getEtudiant(annee, section_id);
	}
	/**
	 * @param annee
	 * @param section_id
	 * @return
	 * @throws PasIdentificationException 
	 * @throws DatabaseErrorException 
	 * @throws InvalidDataException 
	 */
	public ArrayList<Syllabus> getSyllabus(int annee, int section_id) throws PasIdentificationException, DatabaseErrorException, InvalidDataException {
		return sylMan.getSyllabus(annee,section_id);
	}
	public double getPrixSyllabus(Syllabus s) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		return sylMan.getPrixSyllabus(s);
	}
	public double getPrixCommande(Object object) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		return comEtuMan.getPrixCommande(object);
	}
	public void addCommandeEtu(Commande_etu com) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		comEtuMan.addCommandeEtu(com);
	}
	public Lot getLastLot() throws PasIdentificationException, DatabaseErrorException{
		return lotMan.getLastLot();
	}
	public Object getAllCommande(int type, int annee, int section_id, ArrayList<String> etats) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		switch(type){
		case 0: return comEtuMan.getAllCommandeEtu(annee, section_id, etats);
		default: return null;
		}
	}
	public void modifCommandeEtu(Commande_etu com) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		comEtuMan.modifCommandeEtu(com);
	}
	public void delCommandeEtu(Commande_etu com) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		comEtuMan.delCommandeEtu(com);
	}
	public ArrayList<Etudiant> rechercheEtudiant(int syllabus_id, Boolean paye, String etat) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		return rechMan.rechercheEtudiant(syllabus_id, paye, etat);
	}
	public ArrayList<Commande_etu> rechercheSyllabusEtudiant(String etu) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		return rechMan.rechercheSyllabusEtudiant(etu);
	}
	public ArrayList<Syllabus> rechercheSyllabusDispo(Section sect, int annee) throws PasIdentificationException, DatabaseErrorException, InvalidDataException{
		return rechMan.rechercheSyllabusDispo(sect, annee);
	}
	public int getNbrComEtu() throws PasIdentificationException, DatabaseErrorException{
		return comEtuMan.getNbrComEtu();
	}
}
